package com.example.mydataaccesssample;


import com.example.mydataaccesssample.data.CDbManager;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.SimpleCursorAdapter;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;

public class ActList extends ListActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
	
		CDbManager db=new CDbManager(this);
		ListAdapter l_listAdapter=new SimpleCursorAdapter(
			this,
			android.R.layout.simple_list_item_1,
			db.GetBySql("SELECT * FROM tMeeting"),
			new String[]{"fSubject"},
			new int[]{android.R.id.text1}	);
				
		setListAdapter(l_listAdapter);

	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
			
		super.onListItemClick(l, v, position, id);
		Bundle bund =new Bundle();
		bund.putLong("KK", id);		//把Bundle丟回去給ActSqlite
		Intent intent=new Intent();
		intent.putExtras(bund);
		setResult(0, intent);
		finish();
	}
	
}
